#include "aicommanderror.h"

namespace IAlib
{

AiCommandError::AiCommandError()
{
    AiCommand::setType(COMMAND_ERROR);
}

QByteArray AiCommandError::toByteArray() const
{
    QByteArray byte_array;
    QDataStream data(&byte_array, QIODevice::WriteOnly);

    data<<getMode();
    data<<getDescription();

    return byte_array;
}

void AiCommandError::fromByteArray(QByteArray &byte_array)
{
    QDataStream data(&byte_array, QIODevice::ReadOnly);
    int i_temp;
    data>>i_temp;
    setMode((AiCommand::CommandMode)i_temp);
    data>>m_description;
}

}
